package com.chujian.core.entity;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chujian.framework.core.IId;
import com.chujian.framework.core.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 组件
 *
 * @author yj
 * @since 2021-08-25
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("core_component")
@KeySequence("core_component_seq")
@ApiModel(value = "实体", description = "组件")
public class CoreComponent extends BaseEntity implements IId, Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "组件id")
    @TableId("component_id")
    private Long componentId;

    @ApiModelProperty(value = "名称")
    @TableField("component_name")
    private String componentName;

    @ApiModelProperty(value = "类型")
    @TableField("component_type")
    private Integer componentType;

    @ApiModelProperty(value = "配置")
    @TableField("cfg")
    private String cfg;


    // ++++++ 系统拓展 +++++++
    @TableField(exist = false)
    private Map<String, String> query = new HashMap<>();

    @Override
    public Long getId() {
        return this.componentId;
    }

    @Override
    public void setId(Serializable id) {
        if (null != id) {
            this.componentId = Long.parseLong("" + id);
        }
    }

    // ++++++ 业务拓展 +++++++
}
